import axios from 'axios';
import {
	req,
	getData
} from './axiosFun';

/**
 * 商品管理
 **/
// 商品管理-获取商品管理列表
export const GoodsList = (params) => {
	return req("post", "/api/Goods/list", params)
};
// 商品管理-保存商品管理
export const GoodsSave = (params) => {
	return req("post", "/api/Goods/save", params)
};
// 商品管理-删除商品管理
export const GoodsDelete = (params) => {
	return axios.delete("/api/Goods/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(
		res => res.data)
};

/**
 * 工单模块
 **/

//新建工单
export const WorkSave = (params) => {
	return req("post", "http://43.153.72.116:8102/tickets/saveT", params)
};

// 分页加载工单
export const pageByWork = (params) => {
	console.log(params)
	return getData("get", "/tickets/pageByPramas", params)
};

// 加载在线客服名单
export const getOnlineAdminId = (params) => {
	console.log(params)
	return getData("get", "/im/getOnlineAdminId", params)
};

// 分页获取最新公告
export const pageByNewNotice = (params) => {
	console.log(params)
	return getData("get", "/publicnotice/pageByPramas", params)
};

// 分页获取常见问题
export const pageByProgram = (params) => {
	console.log(params)
	return getData("get", "/question/pageByPramas", params)
};

// 获取服务器信息
export const getgoodsinfo = (params) => {
	console.log(params)
	return getData("get", "/areaserver/loadAll", params)
};
// 获取所有模板数据
export const getAllMbData = (params) => {
	console.log(params)
	return getData("get", "/areapackage/loadManyByPramas", params)
};

// 获取文档
export const getDocurl = (params) => {
	console.log(params)
	return getData("get", "/document/loadAll", params)
};
//通过id获取商品信息
export const getGoodsById = (params) => {
	console.log(params)
	return getData("get", "/areapackage/loadConfiguration", params)
};

// 续费获取机器配置
export const getRenew = (params) => {
	console.log(params)
	return getData("get", "/machineinfo/getRenewConfiguration", params)
};

// 创建订单
export const addnewOrder = (params) => {
	console.log(params)
	return getData("get", "/orders/generateOrders", params)
};

// 根据订单id获取数据
export const getOrderInfoById = (params) => {
	console.log(params)
	return getData("get", "/orders/loadObjectByPramas", params)
};

// 获取用户信息
export const getUserInfo = (params) => {
	console.log(params)
	return getData("get", "/userinfo/loadUserByUserId", params)
};

// 修改密码
export const changePassword = (params) => {
	console.log(params)
	return getData("get", "/userlogin/updPwd", params)
};

// 修改个人信息
export const changeUserInfo = (params) => {
	console.log(params)
	// return getData("post", "/userinfo/updateUserInfo", params)
	return req("post", "/userinfo/updateUserInfo", params)
};

// 根据用户id 获取所有信息
export const getMachineInfoByUserId = (params) => {
	console.log(params)
	return getData("get", "/machineinfo/getMachineInfo", params)
};

// 分页获取订单数据
export const getOrderInfoByPage = (params) => {
	console.log(params)
	return getData("get", "/orders/getOrdersPageByUserId", params)
};

// 获取通知
export const getNotice = (params) => {
	console.log(params)
	return getData("get", "/notice/loadNoticeByUserId", params)
};

// 修改通知
export const updNotice = (params) => {
	console.log(params)
	return req("post", "/notice/updT", params)
};

// 获取监控数据
export const getMonitorData = (params) => {
	console.log(params)
	return getData("get", "/virtual/getMonitor", params)
};

// 获取机器信息
export const getMachineInfo = (params) => {
	console.log(params)
	return getData("get", "/machineinfo/getServerInfo", params)
};

// 控制开关机
export const controlPower = (params) => {
	console.log(params)
	return getData("get", "/virtual/powerManage", params)
};

// 获取防火墙数据
export const getFireWallDate = (params) => {
	console.log(params)
	return getData("get", "/securitygroupacl/getAclBySecurityGroupId", params)
};
// 删除安全策略
export const deleteFirleWall = (params) => {
	console.log(params)
	return getData("get", "/securitygroupacl/deleteSecurityGroupAcl", params)
};

// 新增防火墙
export const addFirleWall = (params) => {
	console.log(params)
	return req("post", "/securitygroupacl/saveSecurityGroupAcl", params)
};
// 删除Nat
export const deleteNat = (params) => {
	console.log(params)
	return getData("get", "/natacl/deleteNatAcl", params)
};
// 获取Nat端口映射数据
export const getNatData = (params) => {
	console.log(params)
	return getData("get", "/natacl/getNatAcl", params)
};
// 新增Nat数据
export const addNewNet = (params) => {
	console.log(params)
	return getData("get", "/natacl/saveNatAcl", params)
};